<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>unit/</title>
    <link rel="stylesheet" type="text/css" href="style.css">
    <link rel="stylesheet" type="text/css" href="container.css">
    <script type="text/javascript" src="yahoo-dom-event.js"></script>
    <script type="text/javascript" src="container-min.js"></script>
  </head>

  <body class="yui-skin-sam">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr><td class="title">unit/</td></tr>
      <tr><td class="ruler"><img src="glass.png" width="3" height="3" alt=""></td></tr>

      <tr>
        <td width="100%">
          <table cellpadding="1" border="0" width="100%">
            <tr>
              <td class="headerItem" width="20%">Current file:</td>
              <td class="headerValue" width="80%"><a href="index.html">C:\Program Files (x86)\Apache\htdocs\improved-security\hg\php\Security</a>\<a href="Randomizer.php.html">Randomizer.php</a></td>
            </tr>
            <tr>
              <td class="legendItem" width="20%">Legend:</td>
              <td class="legendValue" width="80%">
                <span class="legendCov">executed</span>
                <span class="legendNoCov">not executed</span>
                <span class="legendDeadCode">dead code</span>
              </td>
            </tr>
          </table>
        </td>
      </tr>

      <tr>
        <td class="ruler"><img src="glass.png" width="3" height="3" alt=""></td>
      </tr>
    </table>

    <br />

    <center>
      <table width="90%" cellpadding="2" cellspacing="1" border="0">
        <tr>
          <td class="tableHead" width="30%">&nbsp;</td>
          <td class="tableHead" colspan="9">Coverage</td>
        </tr>
        <tr>
          <td class="tableHead">&nbsp;</td>
          <td class="tableHead" colspan="3">Classes</td>
          <td class="tableHead" colspan="3">Functions / Methods</td>
          <td class="tableHead" colspan="3">Lines</td>
        </tr>
        <tr>
          <td class="coverItem">Total</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="scarlet_red.png" width="0" height="10" alt="0.00%"><img src="snow.png" width="100" height="10" alt="0.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerLo">0.00%</td>
          <td class="coverNumLo">0 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="70" height="10" alt="70.59%"><img src="snow.png" width="30" height="10" alt="70.59%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">70.59%</td>
          <td class="coverNumHi">12 / 17</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="butter.png" width="66" height="10" alt="66.00%"><img src="snow.png" width="34" height="10" alt="66.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerMed">66.00%</td>
          <td class="coverNumMed">132 / 200</td>
        </tr>

        <tr>
          <td class="tableHead" colspan="10">&nbsp;</td>
        </tr>
        <tr>
          <td class="coverItem"><b><a href="#24">PSL\Randomizer</a></b></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="scarlet_red.png" width="0" height="10" alt="0.00%"><img src="snow.png" width="100" height="10" alt="0.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerLo">0.00%</td>
          <td class="coverNumLo">0 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="70" height="10" alt="70.59%"><img src="snow.png" width="30" height="10" alt="70.59%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">70.59%</td>
          <td class="coverNumHi">12 / 17</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="butter.png" width="66" height="10" alt="66.00%"><img src="snow.png" width="34" height="10" alt="66.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerMed">66.00%</td>
          <td class="coverNumMed">132 / 200</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#48">private function __construct()</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="scarlet_red.png" width="0" height="10" alt="0.00%"><img src="snow.png" width="100" height="10" alt="0.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerLo">0.00%</td>
          <td class="coverNumLo">0 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="scarlet_red.png" width="0" height="10" alt="0.00%"><img src="snow.png" width="100" height="10" alt="0.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerLo">0.00%</td>
          <td class="coverNumLo">0 / 1</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#55">private function __clone()</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="scarlet_red.png" width="0" height="10" alt="0.00%"><img src="snow.png" width="100" height="10" alt="0.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerLo">0.00%</td>
          <td class="coverNumLo">0 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="scarlet_red.png" width="0" height="10" alt="0.00%"><img src="snow.png" width="100" height="10" alt="0.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerLo">0.00%</td>
          <td class="coverNumLo">0 / 1</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#65">public static function getRandomToken($length)</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#75">public static function getRandomBoolean()</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">2 / 2</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#88">public static function getRandomInteger($min, $max)</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">5 / 5</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#104">public static function getRandomFloat()</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">7 / 7</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#134">public static function getRandomGUID()</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">2 / 2</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#146">public static function getRandomBytes($length)</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="scarlet_red.png" width="0" height="10" alt="0.00%"><img src="snow.png" width="100" height="10" alt="0.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerLo">0.00%</td>
          <td class="coverNumLo">0 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="scarlet_red.png" width="28" height="10" alt="28.07%"><img src="snow.png" width="72" height="10" alt="28.07%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerLo">28.07%</td>
          <td class="coverNumLo">16 / 57</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#285">public static function calculateArithmeticMean($data)</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">4 / 4</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#304">public static function calculateEntropy($data)</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">13 / 13</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#333">public static function calculateMonteCarlo($random)</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">30 / 30</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#377">public static function calculateChiSquare($data)</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">13 / 13</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#405">private static function chiSquareEx($x)</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#417">private static function chiSquarePoChiSq($ax, $df)</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="scarlet_red.png" width="0" height="10" alt="0.00%"><img src="snow.png" width="100" height="10" alt="0.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerLo">0.00%</td>
          <td class="coverNumLo">0 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="70" height="10" alt="70.97%"><img src="snow.png" width="30" height="10" alt="70.97%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">70.97%</td>
          <td class="coverNumHi">22 / 31</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#470">private static function chiSquarePoZ($z)</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="scarlet_red.png" width="0" height="10" alt="0.00%"><img src="snow.png" width="100" height="10" alt="0.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerLo">0.00%</td>
          <td class="coverNumLo">0 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="scarlet_red.png" width="27" height="10" alt="27.27%"><img src="snow.png" width="73" height="10" alt="27.27%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerLo">27.27%</td>
          <td class="coverNumLo">6 / 22</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#510">private static function entropyDataPosition($x)</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
        </tr>

        <tr>
          <td class="coverFile" colspan="4">&nbsp;<a href="#520">private static function entropyFrequencies()</a></td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">1 / 1</td>
          <td class="coverBar" align="center" width="100">
            <table border="0" cellspacing="0" cellpadding="1">
              <tr>
                <td class="coverBarOutline"><img src="chameleon.png" width="100" height="10" alt="100.00%"><img src="snow.png" width="0" height="10" alt="100.00%"></td>
              </tr>
            </table>
          </td>
          <td class="coverPerHi">100.00%</td>
          <td class="coverNumHi">9 / 9</td>
        </tr>


      </table>
    </center>

    <br />

    <table cellpadding="0" cellspacing="0" border="0">
      <tr>
        <td><br /></td>
      </tr>
      <tr>
        <td>
<pre class="source">
<span class="lineNum" id="container1"><a name="1"></a><a href="#1" id="line1">       1</a> </span>                : &lt;?php                                                                                                                                   
<span class="lineNum" id="container2"><a name="2"></a><a href="#2" id="line2">       2</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container3"><a name="3"></a><a href="#3" id="line3">       3</a> </span>                : /**                                                                                                                                     
<span class="lineNum" id="container4"><a name="4"></a><a href="#4" id="line4">       4</a> </span>                :  * PHP Security Library.                                                                                                                
<span class="lineNum" id="container5"><a name="5"></a><a href="#5" id="line5">       5</a> </span>                :  *                                                                                                                                      
<span class="lineNum" id="container6"><a name="6"></a><a href="#6" id="line6">       6</a> </span>                :  * @author Kai Sellgren                                                                                                                 
<span class="lineNum" id="container7"><a name="7"></a><a href="#7" id="line7">       7</a> </span>                :  * @copyright Copyright (C) Kai Sellgren 2010                                                                                           
<span class="lineNum" id="container8"><a name="8"></a><a href="#8" id="line8">       8</a> </span>                :  * @package PHP Security Library                                                                                                        
<span class="lineNum" id="container9"><a name="9"></a><a href="#9" id="line9">       9</a> </span>                :  * @since Version 1.00                                                                                                                  
<span class="lineNum" id="container10"><a name="10"></a><a href="#10" id="line10">      10</a> </span>                :  * @license http://opensource.org/licenses/lgpl-3.0.html GNU Lesser General Public License                                              
<span class="lineNum" id="container11"><a name="11"></a><a href="#11" id="line11">      11</a> </span>                :  */                                                                                                                                     
<span class="lineNum" id="container12"><a name="12"></a><a href="#12" id="line12">      12</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container13"><a name="13"></a><a href="#13" id="line13">      13</a> </span>                : namespace PSL;                                                                                                                          
<span class="lineNum" id="container14"><a name="14"></a><a href="#14" id="line14">      14</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container15"><a name="15"></a><a href="#15" id="line15">      15</a> </span>                : /**                                                                                                                                     
<span class="lineNum" id="container16"><a name="16"></a><a href="#16" id="line16">      16</a> </span>                :  * This class allows you to generate strong random data easily -- something that you can't do with PHP natively.                        
<span class="lineNum" id="container17"><a name="17"></a><a href="#17" id="line17">      17</a> </span>                :  * It has been designed to work with multiple environments and provides a handful set of extra methods.                                 
<span class="lineNum" id="container18"><a name="18"></a><a href="#18" id="line18">      18</a> </span>                :  * This class has been written performance in mind meaning that it is not resource intensive.                                           
<span class="lineNum" id="container19"><a name="19"></a><a href="#19" id="line19">      19</a> </span>                :  * In fact, generating a lot of random data can be a lot faster with this library compared to things like mt_rand().                    
<span class="lineNum" id="container20"><a name="20"></a><a href="#20" id="line20">      20</a> </span>                :  *                                                                                                                                      
<span class="lineNum" id="container21"><a name="21"></a><a href="#21" id="line21">      21</a> </span>                :  * @author Kai Sellgren                                                                                                                 
<span class="lineNum" id="container22"><a name="22"></a><a href="#22" id="line22">      22</a> </span>                :  * @since 1.00                                                                                                                          
<span class="lineNum" id="container23"><a name="23"></a><a href="#23" id="line23">      23</a> </span>                :  */                                                                                                                                     
<span class="lineNum" id="container24"><a name="24"></a><a href="#24" id="line24">      24</a> </span>                : class Randomizer                                                                                                                        
<span class="lineNum" id="container25"><a name="25"></a><a href="#25" id="line25">      25</a> </span>                : {                                                                                                                                       
<span class="lineNum" id="container26"><a name="26"></a><a href="#26" id="line26">      26</a> </span>                :     // Precalculated values for Chi-square calculations.                                                                                
<span class="lineNum" id="container27"><a name="27"></a><a href="#27" id="line27">      27</a> </span>                :     const chiSquareZMax = 6.0;                                                                                                          
<span class="lineNum" id="container28"><a name="28"></a><a href="#28" id="line28">      28</a> </span>                :     const chiSquareLogSqrtPi = 0.5723649429247000870717135;                                                                             
<span class="lineNum" id="container29"><a name="29"></a><a href="#29" id="line29">      29</a> </span>                :     const chiSquareISqrtPi = 0.5641895835477562869480795;                                                                               
<span class="lineNum" id="container30"><a name="30"></a><a href="#30" id="line30">      30</a> </span>                :     const chiSquareBigX = 20.0;                                                                                                         
<span class="lineNum" id="container31"><a name="31"></a><a href="#31" id="line31">      31</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container32"><a name="32"></a><a href="#32" id="line32">      32</a> </span>                :     // For entropy calculations.                                                                                                        
<span class="lineNum" id="container33"><a name="33"></a><a href="#33" id="line33">      33</a> </span>                :     private static $entropyNumEvents = 0;                                                                                               
<span class="lineNum" id="container34"><a name="34"></a><a href="#34" id="line34">      34</a> </span>                :     private static $entropyTokenFreqs = array();                                                                                        
<span class="lineNum" id="container35"><a name="35"></a><a href="#35" id="line35">      35</a> </span>                :     private static $entropyTokenProbs = array();                                                                                        
<span class="lineNum" id="container36"><a name="36"></a><a href="#36" id="line36">      36</a> </span>                :     private static $entropyData;                                                                                                        
<span class="lineNum" id="container37"><a name="37"></a><a href="#37" id="line37">      37</a> </span>                :     private static $entropyValue = 0;                                                                                                   
<span class="lineNum" id="container38"><a name="38"></a><a href="#38" id="line38">      38</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container39"><a name="39"></a><a href="#39" id="line39">      39</a> </span>                :     // A pointer to Cryptographic Service Provider.                                                                                     
<span class="lineNum" id="container40"><a name="40"></a><a href="#40" id="line40">      40</a> </span>                :     private static $csp;                                                                                                                
<span class="lineNum" id="container41"><a name="41"></a><a href="#41" id="line41">      41</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container42"><a name="42"></a><a href="#42" id="line42">      42</a> </span>                :     // Reveals whether the random data was produced strongly the last time.                                                             
<span class="lineNum" id="container43"><a name="43"></a><a href="#43" id="line43">      43</a> </span>                :     public static $producedStrongRandomData;                                                                                            
<span class="lineNum" id="container44"><a name="44"></a><a href="#44" id="line44">      44</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container45"><a name="45"></a><a href="#45" id="line45">      45</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container46"><a name="46"></a><a href="#46" id="line46">      46</a> </span>                :      * This is a static class and requires no initialization.                                                                           
<span class="lineNum" id="container47"><a name="47"></a><a href="#47" id="line47">      47</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container48"><a name="48"></a><a href="#48" id="line48">      48</a> </span>                :     private function __construct()                                                                                                      
<span class="lineNum" id="container49"><a name="49"></a><a href="#49" id="line49">      49</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container50"><a name="50"></a><a href="#50" id="line50">      50</a> </span><span class="lineNoCov">              0 :     }                                                                                                                                   </span>
<span class="lineNum" id="container51"><a name="51"></a><a href="#51" id="line51">      51</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container52"><a name="52"></a><a href="#52" id="line52">      52</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container53"><a name="53"></a><a href="#53" id="line53">      53</a> </span>                :      * No cloning available, either.                                                                                                    
<span class="lineNum" id="container54"><a name="54"></a><a href="#54" id="line54">      54</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container55"><a name="55"></a><a href="#55" id="line55">      55</a> </span>                :     private function __clone()                                                                                                          
<span class="lineNum" id="container56"><a name="56"></a><a href="#56" id="line56">      56</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container57"><a name="57"></a><a href="#57" id="line57">      57</a> </span><span class="lineNoCov">              0 :     }                                                                                                                                   </span>
<span class="lineNum" id="container58"><a name="58"></a><a href="#58" id="line58">      58</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container59"><a name="59"></a><a href="#59" id="line59">      59</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container60"><a name="60"></a><a href="#60" id="line60">      60</a> </span>                :      * Returns a random token in hex format. The length is in bytes.                                                                    
<span class="lineNum" id="container61"><a name="61"></a><a href="#61" id="line61">      61</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container62"><a name="62"></a><a href="#62" id="line62">      62</a> </span>                :      * @param int $length The length in bytes.                                                                                          
<span class="lineNum" id="container63"><a name="63"></a><a href="#63" id="line63">      63</a> </span>                :      * @return string                                                                                                                   
<span class="lineNum" id="container64"><a name="64"></a><a href="#64" id="line64">      64</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container65"><a name="65"></a><a href="#65" id="line65">      65</a> </span>                :     public static function getRandomToken($length)                                                                                      
<span class="lineNum" id="container66"><a name="66"></a><a href="#66" id="line66">      66</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container67"><a name="67"></a><a href="#67" id="line67">      67</a> </span><span class="lineCov">              1 :         return bin2hex(Randomizer::getRandomBytes($length));                                                                            </span>
<span class="lineNum" id="container68"><a name="68"></a><a href="#68" id="line68">      68</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container69"><a name="69"></a><a href="#69" id="line69">      69</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container70"><a name="70"></a><a href="#70" id="line70">      70</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container71"><a name="71"></a><a href="#71" id="line71">      71</a> </span>                :      * Returns a random boolean value.                                                                                                  
<span class="lineNum" id="container72"><a name="72"></a><a href="#72" id="line72">      72</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container73"><a name="73"></a><a href="#73" id="line73">      73</a> </span>                :      * @return bool                                                                                                                     
<span class="lineNum" id="container74"><a name="74"></a><a href="#74" id="line74">      74</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container75"><a name="75"></a><a href="#75" id="line75">      75</a> </span>                :     public static function getRandomBoolean()                                                                                           
<span class="lineNum" id="container76"><a name="76"></a><a href="#76" id="line76">      76</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container77"><a name="77"></a><a href="#77" id="line77">      77</a> </span><span class="lineCov">              1 :         $randomByte = Randomizer::getRandomBytes(1);                                                                                    </span>
<span class="lineNum" id="container78"><a name="78"></a><a href="#78" id="line78">      78</a> </span><span class="lineCov">              1 :         return (ord($randomByte) % 2) ? true : false;                                                                                   </span>
<span class="lineNum" id="container79"><a name="79"></a><a href="#79" id="line79">      79</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container80"><a name="80"></a><a href="#80" id="line80">      80</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container81"><a name="81"></a><a href="#81" id="line81">      81</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container82"><a name="82"></a><a href="#82" id="line82">      82</a> </span>                :      * Returns a random integer between the given range.                                                                                
<span class="lineNum" id="container83"><a name="83"></a><a href="#83" id="line83">      83</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container84"><a name="84"></a><a href="#84" id="line84">      84</a> </span>                :      * @param int $min                                                                                                                  
<span class="lineNum" id="container85"><a name="85"></a><a href="#85" id="line85">      85</a> </span>                :      * @param int $max                                                                                                                  
<span class="lineNum" id="container86"><a name="86"></a><a href="#86" id="line86">      86</a> </span>                :      * @return int                                                                                                                      
<span class="lineNum" id="container87"><a name="87"></a><a href="#87" id="line87">      87</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container88"><a name="88"></a><a href="#88" id="line88">      88</a> </span>                :     public static function getRandomInteger($min, $max)                                                                                 
<span class="lineNum" id="container89"><a name="89"></a><a href="#89" id="line89">      89</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container90"><a name="90"></a><a href="#90" id="line90">      90</a> </span><span class="lineCov">              1 :         if ($min &gt;= $max)                                                                                                               </span>
<span class="lineNum" id="container91"><a name="91"></a><a href="#91" id="line91">      91</a> </span><span class="lineCov">              1 :             throw new \Exception('The maximum value cannot be equal or smaller than the minimum value.');                               </span>
<span class="lineNum" id="container92"><a name="92"></a><a href="#92" id="line92">      92</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container93"><a name="93"></a><a href="#93" id="line93">      93</a> </span><span class="lineCov">              1 :         $float = self::getRandomFloat();                                                                                                </span>
<span class="lineNum" id="container94"><a name="94"></a><a href="#94" id="line94">      94</a> </span><span class="lineCov">              1 :         $integer = $min + round($float * ($max - $min));                                                                                </span>
<span class="lineNum" id="container95"><a name="95"></a><a href="#95" id="line95">      95</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container96"><a name="96"></a><a href="#96" id="line96">      96</a> </span><span class="lineCov">              1 :         return (int) $integer;                                                                                                          </span>
<span class="lineNum" id="container97"><a name="97"></a><a href="#97" id="line97">      97</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container98"><a name="98"></a><a href="#98" id="line98">      98</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container99"><a name="99"></a><a href="#99" id="line99">      99</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container100"><a name="100"></a><a href="#100" id="line100">     100</a> </span>                :      * Returns a random float between 0 and 1.                                                                                          
<span class="lineNum" id="container101"><a name="101"></a><a href="#101" id="line101">     101</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container102"><a name="102"></a><a href="#102" id="line102">     102</a> </span>                :      * @return float                                                                                                                    
<span class="lineNum" id="container103"><a name="103"></a><a href="#103" id="line103">     103</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container104"><a name="104"></a><a href="#104" id="line104">     104</a> </span>                :     public static function getRandomFloat()                                                                                             
<span class="lineNum" id="container105"><a name="105"></a><a href="#105" id="line105">     105</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container106"><a name="106"></a><a href="#106" id="line106">     106</a> </span>                :         // TODO: Dont throw away the half of the byte 6, instead store it for the next use.                                             
<span class="lineNum" id="container107"><a name="107"></a><a href="#107" id="line107">     107</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container108"><a name="108"></a><a href="#108" id="line108">     108</a> </span>                :         // PHP uses double precision floating-point format (64-bit) for its floats.                                                     
<span class="lineNum" id="container109"><a name="109"></a><a href="#109" id="line109">     109</a> </span>                :         // They include 52-bits of significand precision, which is 6.5 bytes.                                                           
<span class="lineNum" id="container110"><a name="110"></a><a href="#110" id="line110">     110</a> </span>                :         // Therefore, we need to gather 7 bytes of random data, and throw the last 4-bits away.                                         
<span class="lineNum" id="container111"><a name="111"></a><a href="#111" id="line111">     111</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container112"><a name="112"></a><a href="#112" id="line112">     112</a> </span><span class="lineCov">              2 :         $bytes = Randomizer::getRandomBytes(7);                                                                                         </span>
<span class="lineNum" id="container113"><a name="113"></a><a href="#113" id="line113">     113</a> </span><span class="lineCov">              2 :         $bytes[6] = $bytes[6] &amp; chr(15); // AND the 7th byte with a 0x0F (0000 1111).                                                   </span>
<span class="lineNum" id="container114"><a name="114"></a><a href="#114" id="line114">     114</a> </span><span class="lineCov">              2 :         $bytes .= chr(0); // Add a NULL byte for easier further calculations.                                                           </span>
<span class="lineNum" id="container115"><a name="115"></a><a href="#115" id="line115">     115</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container116"><a name="116"></a><a href="#116" id="line116">     116</a> </span>                :         // V2 = unsigned long (32-bit), we want to unpack two of those = 64-bits = 7 bytes + the NULL byte.                             
<span class="lineNum" id="container117"><a name="117"></a><a href="#117" id="line117">     117</a> </span><span class="lineCov">              2 :         $parts = unpack('V2', $bytes);                                                                                                  </span>
<span class="lineNum" id="container118"><a name="118"></a><a href="#118" id="line118">     118</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container119"><a name="119"></a><a href="#119" id="line119">     119</a> </span>                :         // Create a single number out of the unpacked data.                                                                             
<span class="lineNum" id="container120"><a name="120"></a><a href="#120" id="line120">     120</a> </span>                :         // The second unsigned long has 20-bits of significant information, so, we need to adjust it.                                   
<span class="lineNum" id="container121"><a name="121"></a><a href="#121" id="line121">     121</a> </span><span class="lineCov">              2 :         $number = $parts[1] + pow(2.0, 32) * $parts[2];                                                                                 </span>
<span class="lineNum" id="container122"><a name="122"></a><a href="#122" id="line122">     122</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container123"><a name="123"></a><a href="#123" id="line123">     123</a> </span>                :         // Create the floating point number.                                                                                            
<span class="lineNum" id="container124"><a name="124"></a><a href="#124" id="line124">     124</a> </span><span class="lineCov">              2 :         $number /= pow(2.0, 52);                                                                                                        </span>
<span class="lineNum" id="container125"><a name="125"></a><a href="#125" id="line125">     125</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container126"><a name="126"></a><a href="#126" id="line126">     126</a> </span><span class="lineCov">              2 :         return (float) $number;                                                                                                         </span>
<span class="lineNum" id="container127"><a name="127"></a><a href="#127" id="line127">     127</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container128"><a name="128"></a><a href="#128" id="line128">     128</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container129"><a name="129"></a><a href="#129" id="line129">     129</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container130"><a name="130"></a><a href="#130" id="line130">     130</a> </span>                :      * Returns a random GUID.                                                                                                           
<span class="lineNum" id="container131"><a name="131"></a><a href="#131" id="line131">     131</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container132"><a name="132"></a><a href="#132" id="line132">     132</a> </span>                :      * @return string                                                                                                                   
<span class="lineNum" id="container133"><a name="133"></a><a href="#133" id="line133">     133</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container134"><a name="134"></a><a href="#134" id="line134">     134</a> </span>                :     public static function getRandomGUID()                                                                                              
<span class="lineNum" id="container135"><a name="135"></a><a href="#135" id="line135">     135</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container136"><a name="136"></a><a href="#136" id="line136">     136</a> </span><span class="lineCov">              1 :         $hex = strtoupper(bin2hex(Randomizer::getRandomBytes(16)));                                                                     </span>
<span class="lineNum" id="container137"><a name="137"></a><a href="#137" id="line137">     137</a> </span><span class="lineCov">              1 :         return substr($hex,0,8) . '-' . substr($hex,8,4) . '-' . substr($hex,12,4) . '-' . substr($hex,16,4) . '-' . substr($hex,20,12);</span>
<span class="lineNum" id="container138"><a name="138"></a><a href="#138" id="line138">     138</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container139"><a name="139"></a><a href="#139" id="line139">     139</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container140"><a name="140"></a><a href="#140" id="line140">     140</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container141"><a name="141"></a><a href="#141" id="line141">     141</a> </span>                :      * This method generates strong random data.                                                                                        
<span class="lineNum" id="container142"><a name="142"></a><a href="#142" id="line142">     142</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container143"><a name="143"></a><a href="#143" id="line143">     143</a> </span>                :      * @param int $length The length in bytes.                                                                                          
<span class="lineNum" id="container144"><a name="144"></a><a href="#144" id="line144">     144</a> </span>                :      * @return binary                                                                                                                   
<span class="lineNum" id="container145"><a name="145"></a><a href="#145" id="line145">     145</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container146"><a name="146"></a><a href="#146" id="line146">     146</a> </span>                :     public static function getRandomBytes($length)                                                                                      
<span class="lineNum" id="container147"><a name="147"></a><a href="#147" id="line147">     147</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container148"><a name="148"></a><a href="#148" id="line148">     148</a> </span><span class="lineCov">              6 :         $length = (int) $length;                                                                                                        </span>
<span class="lineNum" id="container149"><a name="149"></a><a href="#149" id="line149">     149</a> </span><span class="lineCov">              6 :         if ($length &lt; 1)                                                                                                                </span>
<span class="lineNum" id="container150"><a name="150"></a><a href="#150" id="line150">     150</a> </span><span class="lineCov">              6 :             throw new \Exception('Length cannot be less than 1 byte.');                                                                 </span>
<span class="lineNum" id="container151"><a name="151"></a><a href="#151" id="line151">     151</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container152"><a name="152"></a><a href="#152" id="line152">     152</a> </span>                :         // Initialize this.                                                                                                             
<span class="lineNum" id="container153"><a name="153"></a><a href="#153" id="line153">     153</a> </span><span class="lineCov">              6 :         self::$producedStrongRandomData = true;                                                                                         </span>
<span class="lineNum" id="container154"><a name="154"></a><a href="#154" id="line154">     154</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container155"><a name="155"></a><a href="#155" id="line155">     155</a> </span><span class="lineCov">              6 :         $isWindows = stripos(PHP_OS, 'WIN') === 0 ? true : false;                                                                       </span>
<span class="lineNum" id="container156"><a name="156"></a><a href="#156" id="line156">     156</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container157"><a name="157"></a><a href="#157" id="line157">     157</a> </span>                :         if ($isWindows)                                                                                                                 
<span class="lineNum" id="container158"><a name="158"></a><a href="#158" id="line158">     158</a> </span><span class="lineCov">              6 :         {                                                                                                                               </span>
<span class="lineNum" id="container159"><a name="159"></a><a href="#159" id="line159">     159</a> </span>                :             // We could use .NET framework to produce high quality random bytes, but VARIANTs do not seem to work.                      
<span class="lineNum" id="container160"><a name="160"></a><a href="#160" id="line160">     160</a> </span>                :             // Thus, this feature has been disabled. If you know a way to fix this, please email me.                                    
<span class="lineNum" id="container161"><a name="161"></a><a href="#161" id="line161">     161</a> </span>                :             // kaisellgren at gmail dot com                                                                                             
<span class="lineNum" id="container162"><a name="162"></a><a href="#162" id="line162">     162</a> </span>                :             /*if (class_exists('DOTNET'))                                                                                               
<span class="lineNum" id="container163"><a name="163"></a><a href="#163" id="line163">     163</a> </span>                :             {                                                                                                                           
<span class="lineNum" id="container164"><a name="164"></a><a href="#164" id="line164">     164</a> </span>                :                 try                                                                                                                     
<span class="lineNum" id="container165"><a name="165"></a><a href="#165" id="line165">     165</a> </span>                :                 {                                                                                                                       
<span class="lineNum" id="container166"><a name="166"></a><a href="#166" id="line166">     166</a> </span>                :                     $csp = new \DOTNET(&quot;mscorlib&quot;, &quot;System.Security.Cryptography.RNGCryptoServiceProvider&quot;);                            
<span class="lineNum" id="container167"><a name="167"></a><a href="#167" id="line167">     167</a> </span>                :                     $array = array_fill(0, $length, null);                                                                              
<span class="lineNum" id="container168"><a name="168"></a><a href="#168" id="line168">     168</a> </span>                :                     $variant = new \VARIANT($array, VT_ARRAY | VT_UI1);                                                                 
<span class="lineNum" id="container169"><a name="169"></a><a href="#169" id="line169">     169</a> </span>                :                     $csp-&gt;GetBytes($variant);                                                                                           
<span class="lineNum" id="container170"><a name="170"></a><a href="#170" id="line170">     170</a> </span>                :                     unset($csp);                                                                                                        
<span class="lineNum" id="container171"><a name="171"></a><a href="#171" id="line171">     171</a> </span>                :                     return (binary) implode('', $array);                                                                                
<span class="lineNum" id="container172"><a name="172"></a><a href="#172" id="line172">     172</a> </span>                :                 }                                                                                                                       
<span class="lineNum" id="container173"><a name="173"></a><a href="#173" id="line173">     173</a> </span>                :                 catch (Exception $e)                                                                                                    
<span class="lineNum" id="container174"><a name="174"></a><a href="#174" id="line174">     174</a> </span>                :                 {                                                                                                                       
<span class="lineNum" id="container175"><a name="175"></a><a href="#175" id="line175">     175</a> </span>                :                 }                                                                                                                       
<span class="lineNum" id="container176"><a name="176"></a><a href="#176" id="line176">     176</a> </span>                :             }*/                                                                                                                         
<span class="lineNum" id="container177"><a name="177"></a><a href="#177" id="line177">     177</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container178"><a name="178"></a><a href="#178" id="line178">     178</a> </span>                :             // Works on Windows when the CAPICOM SDK has been installed and the DLL registered.                                         
<span class="lineNum" id="container179"><a name="179"></a><a href="#179" id="line179">     179</a> </span><span class="lineCov">              6 :             if (class_exists('COM'))                                                                                                    </span>
<span class="lineNum" id="container180"><a name="180"></a><a href="#180" id="line180">     180</a> </span><span class="lineCov">              6 :             {                                                                                                                           </span>
<span class="lineNum" id="container181"><a name="181"></a><a href="#181" id="line181">     181</a> </span>                :                 try                                                                                                                     
<span class="lineNum" id="container182"><a name="182"></a><a href="#182" id="line182">     182</a> </span>                :                 {                                                                                                                       
<span class="lineNum" id="container183"><a name="183"></a><a href="#183" id="line183">     183</a> </span><span class="lineCov">              6 :                     if (self::$csp === null)                                                                                            </span>
<span class="lineNum" id="container184"><a name="184"></a><a href="#184" id="line184">     184</a> </span><span class="lineCov">              6 :                     {                                                                                                                   </span>
<span class="lineNum" id="container185"><a name="185"></a><a href="#185" id="line185">     185</a> </span><span class="lineCov">              1 :                         $csp = new \COM('CAPICOM.Utilities.1');                                                                         </span>
<span class="lineNum" id="container186"><a name="186"></a><a href="#186" id="line186">     186</a> </span><span class="lineCov">              1 :                         self::$csp = $csp;                                                                                              </span>
<span class="lineNum" id="container187"><a name="187"></a><a href="#187" id="line187">     187</a> </span><span class="lineCov">              1 :                     }                                                                                                                   </span>
<span class="lineNum" id="container188"><a name="188"></a><a href="#188" id="line188">     188</a> </span>                :                     else                                                                                                                
<span class="lineNum" id="container189"><a name="189"></a><a href="#189" id="line189">     189</a> </span><span class="lineCov">              6 :                         $csp = self::$csp;                                                                                              </span>
<span class="lineNum" id="container190"><a name="190"></a><a href="#190" id="line190">     190</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container191"><a name="191"></a><a href="#191" id="line191">     191</a> </span><span class="lineCov">              6 :                     $random = (binary) base64_decode($csp-&gt;getrandom($length, 0));                                                      </span>
<span class="lineNum" id="container192"><a name="192"></a><a href="#192" id="line192">     192</a> </span><span class="lineCov">              6 :                     return (binary) $random;                                                                                            </span>
<span class="lineNum" id="container193"><a name="193"></a><a href="#193" id="line193">     193</a> </span>                :                 }                                                                                                                       
<span class="lineNum" id="container194"><a name="194"></a><a href="#194" id="line194">     194</a> </span><span class="lineNoCov">              0 :                 catch (\Exception $e)                                                                                                   </span>
<span class="lineNum" id="container195"><a name="195"></a><a href="#195" id="line195">     195</a> </span>                :                 {                                                                                                                       
<span class="lineNum" id="container196"><a name="196"></a><a href="#196" id="line196">     196</a> </span>                :                 }                                                                                                                       
<span class="lineNum" id="container197"><a name="197"></a><a href="#197" id="line197">     197</a> </span><span class="lineNoCov">              0 :             }                                                                                                                           </span>
<span class="lineNum" id="container198"><a name="198"></a><a href="#198" id="line198">     198</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container199"><a name="199"></a><a href="#199" id="line199">     199</a> </span>                :             // Requires OpenSSL, system() function and the installation path to be in the env PATH.                                     
<span class="lineNum" id="container200"><a name="200"></a><a href="#200" id="line200">     200</a> </span><span class="lineNoCov">              0 :             $random = @shell_exec('openssl rand ' . $length);                                                                           </span>
<span class="lineNum" id="container201"><a name="201"></a><a href="#201" id="line201">     201</a> </span><span class="lineNoCov">              0 :             if ($random !== &quot;&quot;)                                                                                                         </span>
<span class="lineNum" id="container202"><a name="202"></a><a href="#202" id="line202">     202</a> </span><span class="lineNoCov">              0 :                 return (binary) $random;                                                                                                </span>
<span class="lineNum" id="container203"><a name="203"></a><a href="#203" id="line203">     203</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container204"><a name="204"></a><a href="#204" id="line204">     204</a> </span>                :             // Requires GnuPG, system() function and the installation path to be in the env PATH.                                       
<span class="lineNum" id="container205"><a name="205"></a><a href="#205" id="line205">     205</a> </span><span class="lineNoCov">              0 :             $random = @shell_exec('gpg --gen-random 0 ' . $length);                                                                     </span>
<span class="lineNum" id="container206"><a name="206"></a><a href="#206" id="line206">     206</a> </span><span class="lineNoCov">              0 :             if ($random !== &quot;&quot;)                                                                                                         </span>
<span class="lineNum" id="container207"><a name="207"></a><a href="#207" id="line207">     207</a> </span><span class="lineNoCov">              0 :                 return (binary) $random;                                                                                                </span>
<span class="lineNum" id="container208"><a name="208"></a><a href="#208" id="line208">     208</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container209"><a name="209"></a><a href="#209" id="line209">     209</a> </span>                :             // Works on systems that have OpenSSL installed, PHP 5.3 and OpenSSL extension loaded.                                      
<span class="lineNum" id="container210"><a name="210"></a><a href="#210" id="line210">     210</a> </span><span class="lineNoCov">              0 :             if (function_exists('openssl_random_pseudo_bytes'))                                                                         </span>
<span class="lineNum" id="container211"><a name="211"></a><a href="#211" id="line211">     211</a> </span><span class="lineNoCov">              0 :             {                                                                                                                           </span>
<span class="lineNum" id="container212"><a name="212"></a><a href="#212" id="line212">     212</a> </span><span class="lineNoCov">              0 :                 $random = openssl_random_pseudo_bytes($length, $strong);                                                                </span>
<span class="lineNum" id="container213"><a name="213"></a><a href="#213" id="line213">     213</a> </span>                :                 if ($strong)                                                                                                            
<span class="lineNum" id="container214"><a name="214"></a><a href="#214" id="line214">     214</a> </span><span class="lineNoCov">              0 :                     return (binary) $random;                                                                                            </span>
<span class="lineNum" id="container215"><a name="215"></a><a href="#215" id="line215">     215</a> </span><span class="lineNoCov">              0 :             }                                                                                                                           </span>
<span class="lineNum" id="container216"><a name="216"></a><a href="#216" id="line216">     216</a> </span><span class="lineNoCov">              0 :         }                                                                                                                               </span>
<span class="lineNum" id="container217"><a name="217"></a><a href="#217" id="line217">     217</a> </span>                :         else                                                                                                                            
<span class="lineNum" id="container218"><a name="218"></a><a href="#218" id="line218">     218</a> </span>                :         {                                                                                                                               
<span class="lineNum" id="container219"><a name="219"></a><a href="#219" id="line219">     219</a> </span>                :             // Works on systems that have OpenSSL installed, PHP 5.3 and OpenSSL extension loaded.                                      
<span class="lineNum" id="container220"><a name="220"></a><a href="#220" id="line220">     220</a> </span><span class="lineNoCov">              0 :             if (function_exists('openssl_random_pseudo_bytes'))                                                                         </span>
<span class="lineNum" id="container221"><a name="221"></a><a href="#221" id="line221">     221</a> </span><span class="lineNoCov">              0 :             {                                                                                                                           </span>
<span class="lineNum" id="container222"><a name="222"></a><a href="#222" id="line222">     222</a> </span><span class="lineNoCov">              0 :                 $random = openssl_random_pseudo_bytes($length, $strong);                                                                </span>
<span class="lineNum" id="container223"><a name="223"></a><a href="#223" id="line223">     223</a> </span>                :                 if ($strong)                                                                                                            
<span class="lineNum" id="container224"><a name="224"></a><a href="#224" id="line224">     224</a> </span><span class="lineNoCov">              0 :                     return (binary) $random;                                                                                            </span>
<span class="lineNum" id="container225"><a name="225"></a><a href="#225" id="line225">     225</a> </span><span class="lineNoCov">              0 :             }                                                                                                                           </span>
<span class="lineNum" id="container226"><a name="226"></a><a href="#226" id="line226">     226</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container227"><a name="227"></a><a href="#227" id="line227">     227</a> </span>                :             // Works on Sun Solaris, Unix and Linux systems.                                                                            
<span class="lineNum" id="container228"><a name="228"></a><a href="#228" id="line228">     228</a> </span><span class="lineNoCov">              0 :             $fp = @fopen('/dev/urandom', 'rb');                                                                                         </span>
<span class="lineNum" id="container229"><a name="229"></a><a href="#229" id="line229">     229</a> </span>                :             if ($fp)                                                                                                                    
<span class="lineNum" id="container230"><a name="230"></a><a href="#230" id="line230">     230</a> </span><span class="lineNoCov">              0 :             {                                                                                                                           </span>
<span class="lineNum" id="container231"><a name="231"></a><a href="#231" id="line231">     231</a> </span><span class="lineNoCov">              0 :                 $random = fread($fp, $length);                                                                                          </span>
<span class="lineNum" id="container232"><a name="232"></a><a href="#232" id="line232">     232</a> </span><span class="lineNoCov">              0 :                 fclose($fp);                                                                                                            </span>
<span class="lineNum" id="container233"><a name="233"></a><a href="#233" id="line233">     233</a> </span><span class="lineNoCov">              0 :                 return (binary) $random;                                                                                                </span>
<span class="lineNum" id="container234"><a name="234"></a><a href="#234" id="line234">     234</a> </span><span class="lineDeadCode">                :             }                                                                                                                           </span>
<span class="lineNum" id="container235"><a name="235"></a><a href="#235" id="line235">     235</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container236"><a name="236"></a><a href="#236" id="line236">     236</a> </span>                :             // Requires OpenSSL, system() function and the installation path to be in the env PATH.                                     
<span class="lineNum" id="container237"><a name="237"></a><a href="#237" id="line237">     237</a> </span><span class="lineNoCov">              0 :             $random = @shell_exec('openssl rand ' . $length);                                                                           </span>
<span class="lineNum" id="container238"><a name="238"></a><a href="#238" id="line238">     238</a> </span><span class="lineNoCov">              0 :             if ($random !== &quot;&quot;)                                                                                                         </span>
<span class="lineNum" id="container239"><a name="239"></a><a href="#239" id="line239">     239</a> </span><span class="lineNoCov">              0 :                 return (binary) $random;                                                                                                </span>
<span class="lineNum" id="container240"><a name="240"></a><a href="#240" id="line240">     240</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container241"><a name="241"></a><a href="#241" id="line241">     241</a> </span>                :             // Requires GnuPG, system() function and the installation path to be in the env PATH.                                       
<span class="lineNum" id="container242"><a name="242"></a><a href="#242" id="line242">     242</a> </span><span class="lineNoCov">              0 :             $random = @shell_exec('gpg --gen-random 0 ' . $length);                                                                     </span>
<span class="lineNum" id="container243"><a name="243"></a><a href="#243" id="line243">     243</a> </span><span class="lineNoCov">              0 :             if ($random !== &quot;&quot;)                                                                                                         </span>
<span class="lineNum" id="container244"><a name="244"></a><a href="#244" id="line244">     244</a> </span><span class="lineNoCov">              0 :                 return (binary) $random;                                                                                                </span>
<span class="lineNum" id="container245"><a name="245"></a><a href="#245" id="line245">     245</a> </span>                :         }                                                                                                                               
<span class="lineNum" id="container246"><a name="246"></a><a href="#246" id="line246">     246</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container247"><a name="247"></a><a href="#247" id="line247">     247</a> </span>                :         // Set to false.                                                                                                                
<span class="lineNum" id="container248"><a name="248"></a><a href="#248" id="line248">     248</a> </span><span class="lineNoCov">              0 :         self::$producedStrongRandomData = false;                                                                                        </span>
<span class="lineNum" id="container249"><a name="249"></a><a href="#249" id="line249">     249</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container250"><a name="250"></a><a href="#250" id="line250">     250</a> </span>                :         // This is a fallback.                                                                                                          
<span class="lineNum" id="container251"><a name="251"></a><a href="#251" id="line251">     251</a> </span>                :         // In case we were not able to produce good random data on this platform, we do a few tricks.                                   
<span class="lineNum" id="container252"><a name="252"></a><a href="#252" id="line252">     252</a> </span><span class="lineNoCov">              0 :         $random = '';                                                                                                                   </span>
<span class="lineNum" id="container253"><a name="253"></a><a href="#253" id="line253">     253</a> </span><span class="lineNoCov">              0 :         for ($a = 0; $a &lt; $length; $a++)                                                                                                </span>
<span class="lineNum" id="container254"><a name="254"></a><a href="#254" id="line254">     254</a> </span>                :         {                                                                                                                               
<span class="lineNum" id="container255"><a name="255"></a><a href="#255" id="line255">     255</a> </span>                :             // We need to use as many poor &quot;random&quot; sources as possible and make some good of it.                                       
<span class="lineNum" id="container256"><a name="256"></a><a href="#256" id="line256">     256</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container257"><a name="257"></a><a href="#257" id="line257">     257</a> </span>                :             // A twisted generalized feedback shift register called the Mersenne Twister.                                               
<span class="lineNum" id="container258"><a name="258"></a><a href="#258" id="line258">     258</a> </span><span class="lineNoCov">              0 :             $source = mt_rand();                                                                                                        </span>
<span class="lineNum" id="container259"><a name="259"></a><a href="#259" id="line259">     259</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container260"><a name="260"></a><a href="#260" id="line260">     260</a> </span>                :             // In addition to the Mersenne Twister, we use a good ol' Linear Congruential Generator.                                    
<span class="lineNum" id="container261"><a name="261"></a><a href="#261" id="line261">     261</a> </span><span class="lineNoCov">              0 :             $source += bcmul(lcg_value(), pow(2, 52));                                                                                  </span>
<span class="lineNum" id="container262"><a name="262"></a><a href="#262" id="line262">     262</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container263"><a name="263"></a><a href="#263" id="line263">     263</a> </span>                :             // µ-second is a non-random number.                                                                                        
<span class="lineNum" id="container264"><a name="264"></a><a href="#264" id="line264">     264</a> </span><span class="lineNoCov">              0 :             $source += (int) end(explode('.', microtime(true)));                                                                        </span>
<span class="lineNum" id="container265"><a name="265"></a><a href="#265" id="line265">     265</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container266"><a name="266"></a><a href="#266" id="line266">     266</a> </span>                :             // Has a weak avalanche effect and is pretty predictable, but is somewhat non-deterministic.                                
<span class="lineNum" id="container267"><a name="267"></a><a href="#267" id="line267">     267</a> </span><span class="lineNoCov">              0 :             $source += memory_get_usage();                                                                                              </span>
<span class="lineNum" id="container268"><a name="268"></a><a href="#268" id="line268">     268</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container269"><a name="269"></a><a href="#269" id="line269">     269</a> </span>                :             // Same as above, lacks of unpredictability.                                                                                
<span class="lineNum" id="container270"><a name="270"></a><a href="#270" id="line270">     270</a> </span>                :             // This one is also too deterministic, e.g., doesn't change until the next request.                                         
<span class="lineNum" id="container271"><a name="271"></a><a href="#271" id="line271">     271</a> </span><span class="lineNoCov">              0 :             $source += getmypid();                                                                                                      </span>
<span class="lineNum" id="container272"><a name="272"></a><a href="#272" id="line272">     272</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container273"><a name="273"></a><a href="#273" id="line273">     273</a> </span>                :             // Let's make it a byte.                                                                                                    
<span class="lineNum" id="container274"><a name="274"></a><a href="#274" id="line274">     274</a> </span><span class="lineNoCov">              0 :             $random .= chr($source % 255);                                                                                              </span>
<span class="lineNum" id="container275"><a name="275"></a><a href="#275" id="line275">     275</a> </span><span class="lineNoCov">              0 :         }                                                                                                                               </span>
<span class="lineNum" id="container276"><a name="276"></a><a href="#276" id="line276">     276</a> </span><span class="lineNoCov">              0 :         return (binary) $random;                                                                                                        </span>
<span class="lineNum" id="container277"><a name="277"></a><a href="#277" id="line277">     277</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container278"><a name="278"></a><a href="#278" id="line278">     278</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container279"><a name="279"></a><a href="#279" id="line279">     279</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container280"><a name="280"></a><a href="#280" id="line280">     280</a> </span>                :      * Calculates the arithmetic mean for the given data. A value of 127.5 is ideal.                                                    
<span class="lineNum" id="container281"><a name="281"></a><a href="#281" id="line281">     281</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container282"><a name="282"></a><a href="#282" id="line282">     282</a> </span>                :      * @param mixed $data                                                                                                               
<span class="lineNum" id="container283"><a name="283"></a><a href="#283" id="line283">     283</a> </span>                :      * @return float                                                                                                                    
<span class="lineNum" id="container284"><a name="284"></a><a href="#284" id="line284">     284</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container285"><a name="285"></a><a href="#285" id="line285">     285</a> </span>                :     public static function calculateArithmeticMean($data)                                                                               
<span class="lineNum" id="container286"><a name="286"></a><a href="#286" id="line286">     286</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container287"><a name="287"></a><a href="#287" id="line287">     287</a> </span><span class="lineCov">              1 :         $value = 0;                                                                                                                     </span>
<span class="lineNum" id="container288"><a name="288"></a><a href="#288" id="line288">     288</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container289"><a name="289"></a><a href="#289" id="line289">     289</a> </span>                :         // Loop through all the bytes and sum them up.                                                                                  
<span class="lineNum" id="container290"><a name="290"></a><a href="#290" id="line290">     290</a> </span><span class="lineCov">              1 :         for ($a = 0, $b = strlen((binary) $data); $a &lt; $b; $a++)                                                                        </span>
<span class="lineNum" id="container291"><a name="291"></a><a href="#291" id="line291">     291</a> </span><span class="lineCov">              1 :             $value += ord($data[$a]);                                                                                                   </span>
<span class="lineNum" id="container292"><a name="292"></a><a href="#292" id="line292">     292</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container293"><a name="293"></a><a href="#293" id="line293">     293</a> </span>                :         // The average should be 127.5.                                                                                                 
<span class="lineNum" id="container294"><a name="294"></a><a href="#294" id="line294">     294</a> </span><span class="lineCov">              1 :         return $value/$b;                                                                                                               </span>
<span class="lineNum" id="container295"><a name="295"></a><a href="#295" id="line295">     295</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container296"><a name="296"></a><a href="#296" id="line296">     296</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container297"><a name="297"></a><a href="#297" id="line297">     297</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container298"><a name="298"></a><a href="#298" id="line298">     298</a> </span>                :      * Calculates the amount of entropy in bits per byte in the given data.                                                             
<span class="lineNum" id="container299"><a name="299"></a><a href="#299" id="line299">     299</a> </span>                :      * A value of 8-bits per byte is ideal and hints for equal distribution of information.                                             
<span class="lineNum" id="container300"><a name="300"></a><a href="#300" id="line300">     300</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container301"><a name="301"></a><a href="#301" id="line301">     301</a> </span>                :      * @param mixed $data                                                                                                               
<span class="lineNum" id="container302"><a name="302"></a><a href="#302" id="line302">     302</a> </span>                :      * @return float                                                                                                                    
<span class="lineNum" id="container303"><a name="303"></a><a href="#303" id="line303">     303</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container304"><a name="304"></a><a href="#304" id="line304">     304</a> </span>                :     public static function calculateEntropy($data)                                                                                      
<span class="lineNum" id="container305"><a name="305"></a><a href="#305" id="line305">     305</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container306"><a name="306"></a><a href="#306" id="line306">     306</a> </span>                :         // Reset all values.                                                                                                            
<span class="lineNum" id="container307"><a name="307"></a><a href="#307" id="line307">     307</a> </span><span class="lineCov">              1 :         self::$entropyNumEvents = 0;                                                                                                    </span>
<span class="lineNum" id="container308"><a name="308"></a><a href="#308" id="line308">     308</a> </span><span class="lineCov">              1 :         self::$entropyTokenFreqs = array();                                                                                             </span>
<span class="lineNum" id="container309"><a name="309"></a><a href="#309" id="line309">     309</a> </span><span class="lineCov">              1 :         self::$entropyTokenProbs = array();                                                                                             </span>
<span class="lineNum" id="container310"><a name="310"></a><a href="#310" id="line310">     310</a> </span><span class="lineCov">              1 :         self::$entropyValue = 0;                                                                                                        </span>
<span class="lineNum" id="container311"><a name="311"></a><a href="#311" id="line311">     311</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container312"><a name="312"></a><a href="#312" id="line312">     312</a> </span><span class="lineCov">              1 :         self::$entropyData = $data;                                                                                                     </span>
<span class="lineNum" id="container313"><a name="313"></a><a href="#313" id="line313">     313</a> </span><span class="lineCov">              1 :         self::$entropyNumEvents = strlen((binary) self::$entropyData);                                                                  </span>
<span class="lineNum" id="container314"><a name="314"></a><a href="#314" id="line314">     314</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container315"><a name="315"></a><a href="#315" id="line315">     315</a> </span><span class="lineCov">              1 :         self::entropyFrequencies();                                                                                                     </span>
<span class="lineNum" id="container316"><a name="316"></a><a href="#316" id="line316">     316</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container317"><a name="317"></a><a href="#317" id="line317">     317</a> </span><span class="lineCov">              1 :         foreach (self::$entropyTokenFreqs as $token =&gt; $frequency)                                                                      </span>
<span class="lineNum" id="container318"><a name="318"></a><a href="#318" id="line318">     318</a> </span>                :         {                                                                                                                               
<span class="lineNum" id="container319"><a name="319"></a><a href="#319" id="line319">     319</a> </span><span class="lineCov">              1 :             self::$entropyTokenProbs[$token] = $frequency / self::$entropyNumEvents;                                                    </span>
<span class="lineNum" id="container320"><a name="320"></a><a href="#320" id="line320">     320</a> </span><span class="lineCov">              1 :             self::$entropyValue += self::$entropyTokenProbs[$token] * log(self::$entropyTokenProbs[$token], 2);                         </span>
<span class="lineNum" id="container321"><a name="321"></a><a href="#321" id="line321">     321</a> </span><span class="lineCov">              1 :         }                                                                                                                               </span>
<span class="lineNum" id="container322"><a name="322"></a><a href="#322" id="line322">     322</a> </span><span class="lineCov">              1 :         self::$entropyValue = -self::$entropyValue;                                                                                     </span>
<span class="lineNum" id="container323"><a name="323"></a><a href="#323" id="line323">     323</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container324"><a name="324"></a><a href="#324" id="line324">     324</a> </span><span class="lineCov">              1 :         return self::$entropyValue;                                                                                                     </span>
<span class="lineNum" id="container325"><a name="325"></a><a href="#325" id="line325">     325</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container326"><a name="326"></a><a href="#326" id="line326">     326</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container327"><a name="327"></a><a href="#327" id="line327">     327</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container328"><a name="328"></a><a href="#328" id="line328">     328</a> </span>                :      * Calculates PI with Monte Carlo using the given data. A value of pi is ideal.                                                     
<span class="lineNum" id="container329"><a name="329"></a><a href="#329" id="line329">     329</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container330"><a name="330"></a><a href="#330" id="line330">     330</a> </span>                :      * @param mixed $data                                                                                                               
<span class="lineNum" id="container331"><a name="331"></a><a href="#331" id="line331">     331</a> </span>                :      * @return float                                                                                                                    
<span class="lineNum" id="container332"><a name="332"></a><a href="#332" id="line332">     332</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container333"><a name="333"></a><a href="#333" id="line333">     333</a> </span>                :     public static function calculateMonteCarlo($random)                                                                                 
<span class="lineNum" id="container334"><a name="334"></a><a href="#334" id="line334">     334</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container335"><a name="335"></a><a href="#335" id="line335">     335</a> </span><span class="lineCov">              1 :         $monten = 6;                                                                                                                    </span>
<span class="lineNum" id="container336"><a name="336"></a><a href="#336" id="line336">     336</a> </span><span class="lineCov">              1 :         $inCirc = pow(pow(256.0,$monten / 2) - 1, 2.0);                                                                                 </span>
<span class="lineNum" id="container337"><a name="337"></a><a href="#337" id="line337">     337</a> </span><span class="lineCov">              1 :         $mp = 0;                                                                                                                        </span>
<span class="lineNum" id="container338"><a name="338"></a><a href="#338" id="line338">     338</a> </span><span class="lineCov">              1 :         $mCount = 0;                                                                                                                    </span>
<span class="lineNum" id="container339"><a name="339"></a><a href="#339" id="line339">     339</a> </span><span class="lineCov">              1 :         $inMont = 0;                                                                                                                    </span>
<span class="lineNum" id="container340"><a name="340"></a><a href="#340" id="line340">     340</a> </span><span class="lineCov">              1 :         $data = '';                                                                                                                     </span>
<span class="lineNum" id="container341"><a name="341"></a><a href="#341" id="line341">     341</a> </span><span class="lineCov">              1 :         $caret = 0;                                                                                                                     </span>
<span class="lineNum" id="container342"><a name="342"></a><a href="#342" id="line342">     342</a> </span><span class="lineCov">              1 :         $size = strlen((binary) $random);                                                                                               </span>
<span class="lineNum" id="container343"><a name="343"></a><a href="#343" id="line343">     343</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container344"><a name="344"></a><a href="#344" id="line344">     344</a> </span><span class="lineCov">              1 :         while (true)                                                                                                                    </span>
<span class="lineNum" id="container345"><a name="345"></a><a href="#345" id="line345">     345</a> </span>                :         {                                                                                                                               
<span class="lineNum" id="container346"><a name="346"></a><a href="#346" id="line346">     346</a> </span><span class="lineCov">              1 :             if ($caret &gt;= $size)                                                                                                        </span>
<span class="lineNum" id="container347"><a name="347"></a><a href="#347" id="line347">     347</a> </span><span class="lineCov">              1 :                 break;                                                                                                                  </span>
<span class="lineNum" id="container348"><a name="348"></a><a href="#348" id="line348">     348</a> </span><span class="lineCov">              1 :             $data .= substr((binary) $random, $caret, 1);                                                                               </span>
<span class="lineNum" id="container349"><a name="349"></a><a href="#349" id="line349">     349</a> </span><span class="lineCov">              1 :             $caret += 1;                                                                                                                </span>
<span class="lineNum" id="container350"><a name="350"></a><a href="#350" id="line350">     350</a> </span><span class="lineCov">              1 :             $mp++;                                                                                                                      </span>
<span class="lineNum" id="container351"><a name="351"></a><a href="#351" id="line351">     351</a> </span><span class="lineCov">              1 :             if ($mp &gt;= $monten &amp;&amp; strlen((binary) $data) == 6) // every 6th, = 6 bytes                                                  </span>
<span class="lineNum" id="container352"><a name="352"></a><a href="#352" id="line352">     352</a> </span><span class="lineCov">              1 :             {                                                                                                                           </span>
<span class="lineNum" id="container353"><a name="353"></a><a href="#353" id="line353">     353</a> </span><span class="lineCov">              1 :                 $mp = 0;                                                                                                                </span>
<span class="lineNum" id="container354"><a name="354"></a><a href="#354" id="line354">     354</a> </span><span class="lineCov">              1 :                 $mCount++;                                                                                                              </span>
<span class="lineNum" id="container355"><a name="355"></a><a href="#355" id="line355">     355</a> </span><span class="lineCov">              1 :                 $montex = $montey = 0;                                                                                                  </span>
<span class="lineNum" id="container356"><a name="356"></a><a href="#356" id="line356">     356</a> </span><span class="lineCov">              1 :                 for ($mj = 0;$mj &lt; $monten / 2; $mj++)                                                                                  </span>
<span class="lineNum" id="container357"><a name="357"></a><a href="#357" id="line357">     357</a> </span>                :                 {                                                                                                                       
<span class="lineNum" id="container358"><a name="358"></a><a href="#358" id="line358">     358</a> </span><span class="lineCov">              1 :                     $montex = ($montex * 256.0) + ord($data[$mj]);                                                                      </span>
<span class="lineNum" id="container359"><a name="359"></a><a href="#359" id="line359">     359</a> </span><span class="lineCov">              1 :                     $montey = ($montey * 256.0) + ord($data[($monten / 2) + $mj]);                                                      </span>
<span class="lineNum" id="container360"><a name="360"></a><a href="#360" id="line360">     360</a> </span><span class="lineCov">              1 :                 }                                                                                                                       </span>
<span class="lineNum" id="container361"><a name="361"></a><a href="#361" id="line361">     361</a> </span><span class="lineCov">              1 :                 if ((($montex * $montex) + ($montey * $montey)) &lt;= $inCirc)                                                             </span>
<span class="lineNum" id="container362"><a name="362"></a><a href="#362" id="line362">     362</a> </span><span class="lineCov">              1 :                     $inMont++;                                                                                                          </span>
<span class="lineNum" id="container363"><a name="363"></a><a href="#363" id="line363">     363</a> </span><span class="lineCov">              1 :                 $data = '';                                                                                                             </span>
<span class="lineNum" id="container364"><a name="364"></a><a href="#364" id="line364">     364</a> </span><span class="lineCov">              1 :             }                                                                                                                           </span>
<span class="lineNum" id="container365"><a name="365"></a><a href="#365" id="line365">     365</a> </span><span class="lineCov">              1 :         }                                                                                                                               </span>
<span class="lineNum" id="container366"><a name="366"></a><a href="#366" id="line366">     366</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container367"><a name="367"></a><a href="#367" id="line367">     367</a> </span><span class="lineCov">              1 :         $montePi = 4.0 * ($inMont / $mCount);                                                                                           </span>
<span class="lineNum" id="container368"><a name="368"></a><a href="#368" id="line368">     368</a> </span><span class="lineCov">              1 :         return $montePi;                                                                                                                </span>
<span class="lineNum" id="container369"><a name="369"></a><a href="#369" id="line369">     369</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container370"><a name="370"></a><a href="#370" id="line370">     370</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container371"><a name="371"></a><a href="#371" id="line371">     371</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container372"><a name="372"></a><a href="#372" id="line372">     372</a> </span>                :      * A value of 50% is ideal.                                                                                                         
<span class="lineNum" id="container373"><a name="373"></a><a href="#373" id="line373">     373</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container374"><a name="374"></a><a href="#374" id="line374">     374</a> </span>                :      * @param mixed $data                                                                                                               
<span class="lineNum" id="container375"><a name="375"></a><a href="#375" id="line375">     375</a> </span>                :      * @return float                                                                                                                    
<span class="lineNum" id="container376"><a name="376"></a><a href="#376" id="line376">     376</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container377"><a name="377"></a><a href="#377" id="line377">     377</a> </span>                :     public static function calculateChiSquare($data)                                                                                    
<span class="lineNum" id="container378"><a name="378"></a><a href="#378" id="line378">     378</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container379"><a name="379"></a><a href="#379" id="line379">     379</a> </span><span class="lineCov">              1 :         $cCount = array();                                                                                                              </span>
<span class="lineNum" id="container380"><a name="380"></a><a href="#380" id="line380">     380</a> </span><span class="lineCov">              1 :         for ($a = 0, $b = strlen((binary) $data); $a &lt; $b; $a++)                                                                        </span>
<span class="lineNum" id="container381"><a name="381"></a><a href="#381" id="line381">     381</a> </span>                :         {                                                                                                                               
<span class="lineNum" id="container382"><a name="382"></a><a href="#382" id="line382">     382</a> </span><span class="lineCov">              1 :             if (isset($cCount[ord($data[$a])]))                                                                                         </span>
<span class="lineNum" id="container383"><a name="383"></a><a href="#383" id="line383">     383</a> </span><span class="lineCov">              1 :                 $cCount[ord($data[$a])]++;                                                                                              </span>
<span class="lineNum" id="container384"><a name="384"></a><a href="#384" id="line384">     384</a> </span>                :             else                                                                                                                        
<span class="lineNum" id="container385"><a name="385"></a><a href="#385" id="line385">     385</a> </span><span class="lineCov">              1 :                 $cCount[ord($data[$a])] = 1;                                                                                            </span>
<span class="lineNum" id="container386"><a name="386"></a><a href="#386" id="line386">     386</a> </span><span class="lineCov">              1 :         }                                                                                                                               </span>
<span class="lineNum" id="container387"><a name="387"></a><a href="#387" id="line387">     387</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container388"><a name="388"></a><a href="#388" id="line388">     388</a> </span><span class="lineCov">              1 :         $expC = strlen((binary) $data)/256;                                                                                             </span>
<span class="lineNum" id="container389"><a name="389"></a><a href="#389" id="line389">     389</a> </span><span class="lineCov">              1 :         $chiSq = 0;                                                                                                                     </span>
<span class="lineNum" id="container390"><a name="390"></a><a href="#390" id="line390">     390</a> </span><span class="lineCov">              1 :         for ($i = 0; $i &lt; 256; $i++)                                                                                                    </span>
<span class="lineNum" id="container391"><a name="391"></a><a href="#391" id="line391">     391</a> </span>                :         {                                                                                                                               
<span class="lineNum" id="container392"><a name="392"></a><a href="#392" id="line392">     392</a> </span><span class="lineCov">              1 :             $a = (isset($cCount[$i]) ? $cCount[$i] : 0) - $expC;                                                                        </span>
<span class="lineNum" id="container393"><a name="393"></a><a href="#393" id="line393">     393</a> </span><span class="lineCov">              1 :             $chiSq += ($a * $a) / $expC;                                                                                                </span>
<span class="lineNum" id="container394"><a name="394"></a><a href="#394" id="line394">     394</a> </span><span class="lineCov">              1 :         }                                                                                                                               </span>
<span class="lineNum" id="container395"><a name="395"></a><a href="#395" id="line395">     395</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container396"><a name="396"></a><a href="#396" id="line396">     396</a> </span><span class="lineCov">              1 :         return (self::chiSquarePoChiSq(round($chiSq, 2), 255) * 100);                                                                   </span>
<span class="lineNum" id="container397"><a name="397"></a><a href="#397" id="line397">     397</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container398"><a name="398"></a><a href="#398" id="line398">     398</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container399"><a name="399"></a><a href="#399" id="line399">     399</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container400"><a name="400"></a><a href="#400" id="line400">     400</a> </span>                :      * A private method for Chi Square calculations.                                                                                    
<span class="lineNum" id="container401"><a name="401"></a><a href="#401" id="line401">     401</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container402"><a name="402"></a><a href="#402" id="line402">     402</a> </span>                :      * @param float $x                                                                                                                  
<span class="lineNum" id="container403"><a name="403"></a><a href="#403" id="line403">     403</a> </span>                :      * @return float                                                                                                                    
<span class="lineNum" id="container404"><a name="404"></a><a href="#404" id="line404">     404</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container405"><a name="405"></a><a href="#405" id="line405">     405</a> </span>                :     private static function chiSquareEx($x)                                                                                             
<span class="lineNum" id="container406"><a name="406"></a><a href="#406" id="line406">     406</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container407"><a name="407"></a><a href="#407" id="line407">     407</a> </span><span class="lineCov">              1 :         return (($x &lt; -self::chiSquareBigX) ? 0.0 : exp($x));                                                                           </span>
<span class="lineNum" id="container408"><a name="408"></a><a href="#408" id="line408">     408</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container409"><a name="409"></a><a href="#409" id="line409">     409</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container410"><a name="410"></a><a href="#410" id="line410">     410</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container411"><a name="411"></a><a href="#411" id="line411">     411</a> </span>                :      * A private method for Chi Square calculations.                                                                                    
<span class="lineNum" id="container412"><a name="412"></a><a href="#412" id="line412">     412</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container413"><a name="413"></a><a href="#413" id="line413">     413</a> </span>                :      * @param float $ax                                                                                                                 
<span class="lineNum" id="container414"><a name="414"></a><a href="#414" id="line414">     414</a> </span>                :      * @param float $df                                                                                                                 
<span class="lineNum" id="container415"><a name="415"></a><a href="#415" id="line415">     415</a> </span>                :      * @return float                                                                                                                    
<span class="lineNum" id="container416"><a name="416"></a><a href="#416" id="line416">     416</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container417"><a name="417"></a><a href="#417" id="line417">     417</a> </span>                :     private static function chiSquarePoChiSq($ax, $df)                                                                                  
<span class="lineNum" id="container418"><a name="418"></a><a href="#418" id="line418">     418</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container419"><a name="419"></a><a href="#419" id="line419">     419</a> </span><span class="lineCov">              1 :         $x = $ax;                                                                                                                       </span>
<span class="lineNum" id="container420"><a name="420"></a><a href="#420" id="line420">     420</a> </span><span class="lineCov">              1 :         if ($x &lt;= 0.0 || $df &lt; 1)                                                                                                       </span>
<span class="lineNum" id="container421"><a name="421"></a><a href="#421" id="line421">     421</a> </span><span class="lineCov">              1 :             return 1.0;                                                                                                                 </span>
<span class="lineNum" id="container422"><a name="422"></a><a href="#422" id="line422">     422</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container423"><a name="423"></a><a href="#423" id="line423">     423</a> </span><span class="lineCov">              1 :         $a = 0.5 * $x;                                                                                                                  </span>
<span class="lineNum" id="container424"><a name="424"></a><a href="#424" id="line424">     424</a> </span><span class="lineCov">              1 :         $even = (2 * (int) ($df / 2)) == $df;                                                                                           </span>
<span class="lineNum" id="container425"><a name="425"></a><a href="#425" id="line425">     425</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container426"><a name="426"></a><a href="#426" id="line426">     426</a> </span><span class="lineCov">              1 :         if ($df &gt; 1)                                                                                                                    </span>
<span class="lineNum" id="container427"><a name="427"></a><a href="#427" id="line427">     427</a> </span><span class="lineCov">              1 :             $y = self::chiSquareEx(-$a);                                                                                                </span>
<span class="lineNum" id="container428"><a name="428"></a><a href="#428" id="line428">     428</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container429"><a name="429"></a><a href="#429" id="line429">     429</a> </span><span class="lineCov">              1 :         $s = ($even ? $y : (2.0 * self::chiSquarePoZ(-sqrt($x))));                                                                      </span>
<span class="lineNum" id="container430"><a name="430"></a><a href="#430" id="line430">     430</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container431"><a name="431"></a><a href="#431" id="line431">     431</a> </span><span class="lineCov">              1 :         if ($df &gt; 2)                                                                                                                    </span>
<span class="lineNum" id="container432"><a name="432"></a><a href="#432" id="line432">     432</a> </span><span class="lineCov">              1 :         {                                                                                                                               </span>
<span class="lineNum" id="container433"><a name="433"></a><a href="#433" id="line433">     433</a> </span><span class="lineCov">              1 :             $x = 0.5 * ($df - 1.0);                                                                                                     </span>
<span class="lineNum" id="container434"><a name="434"></a><a href="#434" id="line434">     434</a> </span><span class="lineCov">              1 :             $z = ($even ? 1.0 : 0.5);                                                                                                   </span>
<span class="lineNum" id="container435"><a name="435"></a><a href="#435" id="line435">     435</a> </span><span class="lineCov">              1 :             if ($a &gt; self::chiSquareBigX)                                                                                               </span>
<span class="lineNum" id="container436"><a name="436"></a><a href="#436" id="line436">     436</a> </span><span class="lineCov">              1 :             {                                                                                                                           </span>
<span class="lineNum" id="container437"><a name="437"></a><a href="#437" id="line437">     437</a> </span><span class="lineCov">              1 :                 $e = ($even ? 0.0 : self::chiSquareLogSqrtPi);                                                                          </span>
<span class="lineNum" id="container438"><a name="438"></a><a href="#438" id="line438">     438</a> </span><span class="lineCov">              1 :                 $c = log($a);                                                                                                           </span>
<span class="lineNum" id="container439"><a name="439"></a><a href="#439" id="line439">     439</a> </span><span class="lineCov">              1 :                 while ($z &lt;= $x)                                                                                                        </span>
<span class="lineNum" id="container440"><a name="440"></a><a href="#440" id="line440">     440</a> </span>                :                 {                                                                                                                       
<span class="lineNum" id="container441"><a name="441"></a><a href="#441" id="line441">     441</a> </span><span class="lineCov">              1 :                     $e = log($z) + $e;                                                                                                  </span>
<span class="lineNum" id="container442"><a name="442"></a><a href="#442" id="line442">     442</a> </span><span class="lineCov">              1 :                     $s += self::chiSquareEx($c * $z - $a - $e);                                                                         </span>
<span class="lineNum" id="container443"><a name="443"></a><a href="#443" id="line443">     443</a> </span><span class="lineCov">              1 :                     $z += 1.0;                                                                                                          </span>
<span class="lineNum" id="container444"><a name="444"></a><a href="#444" id="line444">     444</a> </span><span class="lineCov">              1 :                 }                                                                                                                       </span>
<span class="lineNum" id="container445"><a name="445"></a><a href="#445" id="line445">     445</a> </span><span class="lineCov">              1 :                 return ($s);                                                                                                            </span>
<span class="lineNum" id="container446"><a name="446"></a><a href="#446" id="line446">     446</a> </span><span class="lineDeadCode">                :             }                                                                                                                           </span>
<span class="lineNum" id="container447"><a name="447"></a><a href="#447" id="line447">     447</a> </span>                :             else                                                                                                                        
<span class="lineNum" id="container448"><a name="448"></a><a href="#448" id="line448">     448</a> </span>                :             {                                                                                                                           
<span class="lineNum" id="container449"><a name="449"></a><a href="#449" id="line449">     449</a> </span><span class="lineNoCov">              0 :                 $e = ($even ? 1.0 : (self::chiSquareISqrtPi / sqrt($a)));                                                               </span>
<span class="lineNum" id="container450"><a name="450"></a><a href="#450" id="line450">     450</a> </span><span class="lineNoCov">              0 :                 $c = 0.0;                                                                                                               </span>
<span class="lineNum" id="container451"><a name="451"></a><a href="#451" id="line451">     451</a> </span><span class="lineNoCov">              0 :                 while ($z &lt;= $x)                                                                                                        </span>
<span class="lineNum" id="container452"><a name="452"></a><a href="#452" id="line452">     452</a> </span>                :                 {                                                                                                                       
<span class="lineNum" id="container453"><a name="453"></a><a href="#453" id="line453">     453</a> </span><span class="lineNoCov">              0 :                     $e = $e * ($a / $z);                                                                                                </span>
<span class="lineNum" id="container454"><a name="454"></a><a href="#454" id="line454">     454</a> </span><span class="lineNoCov">              0 :                     $c = $c + $e;                                                                                                       </span>
<span class="lineNum" id="container455"><a name="455"></a><a href="#455" id="line455">     455</a> </span><span class="lineNoCov">              0 :                     $z += 1.0;                                                                                                          </span>
<span class="lineNum" id="container456"><a name="456"></a><a href="#456" id="line456">     456</a> </span><span class="lineNoCov">              0 :                 }                                                                                                                       </span>
<span class="lineNum" id="container457"><a name="457"></a><a href="#457" id="line457">     457</a> </span><span class="lineNoCov">              0 :                 return ($c * $y + $s);                                                                                                  </span>
<span class="lineNum" id="container458"><a name="458"></a><a href="#458" id="line458">     458</a> </span>                :             }                                                                                                                           
<span class="lineNum" id="container459"><a name="459"></a><a href="#459" id="line459">     459</a> </span><span class="lineDeadCode">                :         }                                                                                                                               </span>
<span class="lineNum" id="container460"><a name="460"></a><a href="#460" id="line460">     460</a> </span>                :         else                                                                                                                            
<span class="lineNum" id="container461"><a name="461"></a><a href="#461" id="line461">     461</a> </span><span class="lineNoCov">              0 :             return $s;                                                                                                                  </span>
<span class="lineNum" id="container462"><a name="462"></a><a href="#462" id="line462">     462</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container463"><a name="463"></a><a href="#463" id="line463">     463</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container464"><a name="464"></a><a href="#464" id="line464">     464</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container465"><a name="465"></a><a href="#465" id="line465">     465</a> </span>                :      * A private method for Chi Square calculations.                                                                                    
<span class="lineNum" id="container466"><a name="466"></a><a href="#466" id="line466">     466</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container467"><a name="467"></a><a href="#467" id="line467">     467</a> </span>                :      * @param float $z                                                                                                                  
<span class="lineNum" id="container468"><a name="468"></a><a href="#468" id="line468">     468</a> </span>                :      * @return float                                                                                                                    
<span class="lineNum" id="container469"><a name="469"></a><a href="#469" id="line469">     469</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container470"><a name="470"></a><a href="#470" id="line470">     470</a> </span>                :     private static function chiSquarePoZ($z)                                                                                            
<span class="lineNum" id="container471"><a name="471"></a><a href="#471" id="line471">     471</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container472"><a name="472"></a><a href="#472" id="line472">     472</a> </span><span class="lineCov">              1 :         if ($z == 0.0)                                                                                                                  </span>
<span class="lineNum" id="container473"><a name="473"></a><a href="#473" id="line473">     473</a> </span><span class="lineCov">              1 :             $x = 0.0;                                                                                                                   </span>
<span class="lineNum" id="container474"><a name="474"></a><a href="#474" id="line474">     474</a> </span>                :         else                                                                                                                            
<span class="lineNum" id="container475"><a name="475"></a><a href="#475" id="line475">     475</a> </span>                :         {                                                                                                                               
<span class="lineNum" id="container476"><a name="476"></a><a href="#476" id="line476">     476</a> </span><span class="lineCov">              1 :             $y = 0.5 * abs($z);                                                                                                         </span>
<span class="lineNum" id="container477"><a name="477"></a><a href="#477" id="line477">     477</a> </span><span class="lineCov">              1 :             if ($y &gt;= (self::chiSquareZMax * 0.5))                                                                                      </span>
<span class="lineNum" id="container478"><a name="478"></a><a href="#478" id="line478">     478</a> </span><span class="lineCov">              1 :                 $x = 1.0;                                                                                                               </span>
<span class="lineNum" id="container479"><a name="479"></a><a href="#479" id="line479">     479</a> </span><span class="lineNoCov">              0 :             else if ($y &lt; 1.0)                                                                                                          </span>
<span class="lineNum" id="container480"><a name="480"></a><a href="#480" id="line480">     480</a> </span><span class="lineNoCov">              0 :             {                                                                                                                           </span>
<span class="lineNum" id="container481"><a name="481"></a><a href="#481" id="line481">     481</a> </span><span class="lineNoCov">              0 :                 $w = $y * $y;                                                                                                           </span>
<span class="lineNum" id="container482"><a name="482"></a><a href="#482" id="line482">     482</a> </span>                :                 $x = ((((((((0.000124818987 * $w                                                                                        
<span class="lineNum" id="container483"><a name="483"></a><a href="#483" id="line483">     483</a> </span><span class="lineNoCov">              0 :                 -0.001075204047) * $w +0.005198775019) * $w                                                                             </span>
<span class="lineNum" id="container484"><a name="484"></a><a href="#484" id="line484">     484</a> </span><span class="lineNoCov">              0 :                 -0.019198292004) * $w +0.059054035642) * $w                                                                             </span>
<span class="lineNum" id="container485"><a name="485"></a><a href="#485" id="line485">     485</a> </span><span class="lineNoCov">              0 :                 -0.151968751364) * $w +0.319152932694) * $w                                                                             </span>
<span class="lineNum" id="container486"><a name="486"></a><a href="#486" id="line486">     486</a> </span><span class="lineNoCov">              0 :                 -0.531923007300) * $w +0.797884560593) * $y * 2.0;                                                                      </span>
<span class="lineNum" id="container487"><a name="487"></a><a href="#487" id="line487">     487</a> </span><span class="lineNoCov">              0 :             }                                                                                                                           </span>
<span class="lineNum" id="container488"><a name="488"></a><a href="#488" id="line488">     488</a> </span>                :             else                                                                                                                        
<span class="lineNum" id="container489"><a name="489"></a><a href="#489" id="line489">     489</a> </span>                :             {                                                                                                                           
<span class="lineNum" id="container490"><a name="490"></a><a href="#490" id="line490">     490</a> </span><span class="lineNoCov">              0 :                 $y -= 2.0;                                                                                                              </span>
<span class="lineNum" id="container491"><a name="491"></a><a href="#491" id="line491">     491</a> </span>                :                 $x = (((((((((((((-0.000045255659 * $y                                                                                  
<span class="lineNum" id="container492"><a name="492"></a><a href="#492" id="line492">     492</a> </span><span class="lineNoCov">              0 :                 +0.000152529290) * $y -0.000019538132) * $y                                                                             </span>
<span class="lineNum" id="container493"><a name="493"></a><a href="#493" id="line493">     493</a> </span><span class="lineNoCov">              0 :                 -0.000676904986) * $y +0.001390604284) * $y                                                                             </span>
<span class="lineNum" id="container494"><a name="494"></a><a href="#494" id="line494">     494</a> </span><span class="lineNoCov">              0 :                 -0.000794620820) * $y -0.002034254874) * $y                                                                             </span>
<span class="lineNum" id="container495"><a name="495"></a><a href="#495" id="line495">     495</a> </span><span class="lineNoCov">              0 :                 +0.006549791214) * $y -0.010557625006) * $y                                                                             </span>
<span class="lineNum" id="container496"><a name="496"></a><a href="#496" id="line496">     496</a> </span><span class="lineNoCov">              0 :                 +0.011630447319) * $y -0.009279453341) * $y                                                                             </span>
<span class="lineNum" id="container497"><a name="497"></a><a href="#497" id="line497">     497</a> </span><span class="lineNoCov">              0 :                 +0.005353579108) * $y -0.002141268741) * $y                                                                             </span>
<span class="lineNum" id="container498"><a name="498"></a><a href="#498" id="line498">     498</a> </span><span class="lineNoCov">              0 :                 +0.000535310849) * $y +0.999936657524;                                                                                  </span>
<span class="lineNum" id="container499"><a name="499"></a><a href="#499" id="line499">     499</a> </span>                :             }                                                                                                                           
<span class="lineNum" id="container500"><a name="500"></a><a href="#500" id="line500">     500</a> </span>                :         }                                                                                                                               
<span class="lineNum" id="container501"><a name="501"></a><a href="#501" id="line501">     501</a> </span><span class="lineCov">              1 :         return ($z &gt; 0.0 ? (($x + 1.0) * 0.5) : ((1.0 - $x) * 0.5));                                                                    </span>
<span class="lineNum" id="container502"><a name="502"></a><a href="#502" id="line502">     502</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container503"><a name="503"></a><a href="#503" id="line503">     503</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container504"><a name="504"></a><a href="#504" id="line504">     504</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container505"><a name="505"></a><a href="#505" id="line505">     505</a> </span>                :      * A private method for returning a byte of a certain position.                                                                     
<span class="lineNum" id="container506"><a name="506"></a><a href="#506" id="line506">     506</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container507"><a name="507"></a><a href="#507" id="line507">     507</a> </span>                :      * @param integer $x                                                                                                                
<span class="lineNum" id="container508"><a name="508"></a><a href="#508" id="line508">     508</a> </span>                :      * @return binary                                                                                                                   
<span class="lineNum" id="container509"><a name="509"></a><a href="#509" id="line509">     509</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container510"><a name="510"></a><a href="#510" id="line510">     510</a> </span>                :     private static function entropyDataPosition($x)                                                                                     
<span class="lineNum" id="container511"><a name="511"></a><a href="#511" id="line511">     511</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container512"><a name="512"></a><a href="#512" id="line512">     512</a> </span><span class="lineCov">              1 :         return substr((binary) self::$entropyData, $x, 1);                                                                              </span>
<span class="lineNum" id="container513"><a name="513"></a><a href="#513" id="line513">     513</a> </span><span class="lineDeadCode">                :     }                                                                                                                                   </span>
<span class="lineNum" id="container514"><a name="514"></a><a href="#514" id="line514">     514</a> </span>                :                                                                                                                                         
<span class="lineNum" id="container515"><a name="515"></a><a href="#515" id="line515">     515</a> </span>                :     /**                                                                                                                                 
<span class="lineNum" id="container516"><a name="516"></a><a href="#516" id="line516">     516</a> </span>                :      * A private method for calculating frequencies.                                                                                    
<span class="lineNum" id="container517"><a name="517"></a><a href="#517" id="line517">     517</a> </span>                :      *                                                                                                                                  
<span class="lineNum" id="container518"><a name="518"></a><a href="#518" id="line518">     518</a> </span>                :      * @return void                                                                                                                     
<span class="lineNum" id="container519"><a name="519"></a><a href="#519" id="line519">     519</a> </span>                :      */                                                                                                                                 
<span class="lineNum" id="container520"><a name="520"></a><a href="#520" id="line520">     520</a> </span>                :     private static function entropyFrequencies()                                                                                        
<span class="lineNum" id="container521"><a name="521"></a><a href="#521" id="line521">     521</a> </span>                :     {                                                                                                                                   
<span class="lineNum" id="container522"><a name="522"></a><a href="#522" id="line522">     522</a> </span><span class="lineCov">              1 :         $tokenFreqs = array();                                                                                                          </span>
<span class="lineNum" id="container523"><a name="523"></a><a href="#523" id="line523">     523</a> </span><span class="lineCov">              1 :         for ($i = 0; $i &lt; self::$entropyNumEvents; $i++)                                                                                </span>
<span class="lineNum" id="container524"><a name="524"></a><a href="#524" id="line524">     524</a> </span>                :         {                                                                                                                               
<span class="lineNum" id="container525"><a name="525"></a><a href="#525" id="line525">     525</a> </span><span class="lineCov">              1 :             $tmp = ord(self::entropyDataPosition($i));                                                                                  </span>
<span class="lineNum" id="container526"><a name="526"></a><a href="#526" id="line526">     526</a> </span><span class="lineCov">              1 :             if (isset($tokenFreqs[$tmp]))                                                                                               </span>
<span class="lineNum" id="container527"><a name="527"></a><a href="#527" id="line527">     527</a> </span><span class="lineCov">              1 :                 $tokenFreqs[$tmp]++;                                                                                                    </span>
<span class="lineNum" id="container528"><a name="528"></a><a href="#528" id="line528">     528</a> </span>                :             else                                                                                                                        
<span class="lineNum" id="container529"><a name="529"></a><a href="#529" id="line529">     529</a> </span><span class="lineCov">              1 :                 $tokenFreqs[$tmp] = 1;                                                                                                  </span>
<span class="lineNum" id="container530"><a name="530"></a><a href="#530" id="line530">     530</a> </span><span class="lineCov">              1 :         }                                                                                                                               </span>
<span class="lineNum" id="container531"><a name="531"></a><a href="#531" id="line531">     531</a> </span><span class="lineCov">              1 :         self::$entropyTokenFreqs = $tokenFreqs;                                                                                         </span>
<span class="lineNum" id="container532"><a name="532"></a><a href="#532" id="line532">     532</a> </span><span class="lineCov">              1 :     }                                                                                                                                   </span>

</pre>
        </td>
      </tr>
    </table>

    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr><td class="ruler"><img src="glass.png" width="3" height="3" alt=""></td></tr>
      <tr><td class="versionInfo">Generated by <a href="http://www.phpunit.de/" target="_top">PHPUnit 3.4.9</a> and <a href="http://www.xdebug.org/" target="_top">Xdebug 2.0.5</a> using <a href="http://www.php.net/" target="_top">PHP 5.3.3</a> at Sun Nov 21 11:35:32 GMT 2010.</td></tr>
    </table>

    <br />

    <script type="text/javascript">
      //<![CDATA[
      $E = YAHOO.util.Event;
      YAHOO.namespace("phpunit.container");
      YAHOO.phpunit.container.panelsData = {
        "panel67": {
          "header": "1 test covers line 67",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomToken</li></ul>",
          "footer": ""
        },
        "panel77": {
          "header": "1 test covers line 77",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li></ul>",
          "footer": ""
        },
        "panel78": {
          "header": "1 test covers line 78",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li></ul>",
          "footer": ""
        },
        "panel90": {
          "header": "1 test covers line 90",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomInteger</li></ul>",
          "footer": ""
        },
        "panel91": {
          "header": "1 test covers line 91",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomInteger</li></ul>",
          "footer": ""
        },
        "panel93": {
          "header": "1 test covers line 93",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomInteger</li></ul>",
          "footer": ""
        },
        "panel94": {
          "header": "1 test covers line 94",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomInteger</li></ul>",
          "footer": ""
        },
        "panel96": {
          "header": "1 test covers line 96",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomInteger</li></ul>",
          "footer": ""
        },
        "panel112": {
          "header": "2 tests cover line 112",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li></ul>",
          "footer": ""
        },
        "panel113": {
          "header": "2 tests cover line 113",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li></ul>",
          "footer": ""
        },
        "panel114": {
          "header": "2 tests cover line 114",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li></ul>",
          "footer": ""
        },
        "panel117": {
          "header": "2 tests cover line 117",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li></ul>",
          "footer": ""
        },
        "panel121": {
          "header": "2 tests cover line 121",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li></ul>",
          "footer": ""
        },
        "panel124": {
          "header": "2 tests cover line 124",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li></ul>",
          "footer": ""
        },
        "panel126": {
          "header": "2 tests cover line 126",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li></ul>",
          "footer": ""
        },
        "panel136": {
          "header": "1 test covers line 136",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel137": {
          "header": "1 test covers line 137",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel148": {
          "header": "6 tests cover line 148",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomToken</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel149": {
          "header": "6 tests cover line 149",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomToken</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel150": {
          "header": "6 tests cover line 150",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomToken</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel153": {
          "header": "6 tests cover line 153",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomToken</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel155": {
          "header": "6 tests cover line 155",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomToken</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel158": {
          "header": "6 tests cover line 158",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomToken</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel179": {
          "header": "6 tests cover line 179",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomToken</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel180": {
          "header": "6 tests cover line 180",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomToken</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel183": {
          "header": "6 tests cover line 183",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomToken</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel184": {
          "header": "6 tests cover line 184",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomToken</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel185": {
          "header": "1 test covers line 185",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li></ul>",
          "footer": ""
        },
        "panel186": {
          "header": "1 test covers line 186",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li></ul>",
          "footer": ""
        },
        "panel187": {
          "header": "1 test covers line 187",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li></ul>",
          "footer": ""
        },
        "panel189": {
          "header": "6 tests cover line 189",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomToken</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel191": {
          "header": "6 tests cover line 191",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomToken</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel192": {
          "header": "6 tests cover line 192",
          "body": "<ul><li class=\"testError\">EncrypterTest::testEncryption</li><li class=\"testPassed\">RandomizerTest::testRandomBoolean</li><li class=\"testPassed\">RandomizerTest::testRandomInteger</li><li class=\"testPassed\">RandomizerTest::testRandomToken</li><li class=\"testPassed\">RandomizerTest::testRandomFloat</li><li class=\"testPassed\">RandomizerTest::testRandomGUID</li></ul>",
          "footer": ""
        },
        "panel287": {
          "header": "1 test covers line 287",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testArithmeticMean</li></ul>",
          "footer": ""
        },
        "panel290": {
          "header": "1 test covers line 290",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testArithmeticMean</li></ul>",
          "footer": ""
        },
        "panel291": {
          "header": "1 test covers line 291",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testArithmeticMean</li></ul>",
          "footer": ""
        },
        "panel294": {
          "header": "1 test covers line 294",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testArithmeticMean</li></ul>",
          "footer": ""
        },
        "panel307": {
          "header": "1 test covers line 307",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel308": {
          "header": "1 test covers line 308",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel309": {
          "header": "1 test covers line 309",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel310": {
          "header": "1 test covers line 310",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel312": {
          "header": "1 test covers line 312",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel313": {
          "header": "1 test covers line 313",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel315": {
          "header": "1 test covers line 315",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel317": {
          "header": "1 test covers line 317",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel319": {
          "header": "1 test covers line 319",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel320": {
          "header": "1 test covers line 320",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel321": {
          "header": "1 test covers line 321",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel322": {
          "header": "1 test covers line 322",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel324": {
          "header": "1 test covers line 324",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel335": {
          "header": "1 test covers line 335",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel336": {
          "header": "1 test covers line 336",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel337": {
          "header": "1 test covers line 337",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel338": {
          "header": "1 test covers line 338",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel339": {
          "header": "1 test covers line 339",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel340": {
          "header": "1 test covers line 340",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel341": {
          "header": "1 test covers line 341",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel342": {
          "header": "1 test covers line 342",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel344": {
          "header": "1 test covers line 344",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel346": {
          "header": "1 test covers line 346",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel347": {
          "header": "1 test covers line 347",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel348": {
          "header": "1 test covers line 348",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel349": {
          "header": "1 test covers line 349",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel350": {
          "header": "1 test covers line 350",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel351": {
          "header": "1 test covers line 351",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel352": {
          "header": "1 test covers line 352",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel353": {
          "header": "1 test covers line 353",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel354": {
          "header": "1 test covers line 354",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel355": {
          "header": "1 test covers line 355",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel356": {
          "header": "1 test covers line 356",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel358": {
          "header": "1 test covers line 358",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel359": {
          "header": "1 test covers line 359",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel360": {
          "header": "1 test covers line 360",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel361": {
          "header": "1 test covers line 361",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel362": {
          "header": "1 test covers line 362",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel363": {
          "header": "1 test covers line 363",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel364": {
          "header": "1 test covers line 364",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel365": {
          "header": "1 test covers line 365",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel367": {
          "header": "1 test covers line 367",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel368": {
          "header": "1 test covers line 368",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testMonteCarlo</li></ul>",
          "footer": ""
        },
        "panel379": {
          "header": "1 test covers line 379",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel380": {
          "header": "1 test covers line 380",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel382": {
          "header": "1 test covers line 382",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel383": {
          "header": "1 test covers line 383",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel385": {
          "header": "1 test covers line 385",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel386": {
          "header": "1 test covers line 386",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel388": {
          "header": "1 test covers line 388",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel389": {
          "header": "1 test covers line 389",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel390": {
          "header": "1 test covers line 390",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel392": {
          "header": "1 test covers line 392",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel393": {
          "header": "1 test covers line 393",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel394": {
          "header": "1 test covers line 394",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel396": {
          "header": "1 test covers line 396",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel407": {
          "header": "1 test covers line 407",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel419": {
          "header": "1 test covers line 419",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel420": {
          "header": "1 test covers line 420",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel421": {
          "header": "1 test covers line 421",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel423": {
          "header": "1 test covers line 423",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel424": {
          "header": "1 test covers line 424",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel426": {
          "header": "1 test covers line 426",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel427": {
          "header": "1 test covers line 427",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel429": {
          "header": "1 test covers line 429",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel431": {
          "header": "1 test covers line 431",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel432": {
          "header": "1 test covers line 432",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel433": {
          "header": "1 test covers line 433",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel434": {
          "header": "1 test covers line 434",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel435": {
          "header": "1 test covers line 435",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel436": {
          "header": "1 test covers line 436",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel437": {
          "header": "1 test covers line 437",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel438": {
          "header": "1 test covers line 438",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel439": {
          "header": "1 test covers line 439",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel441": {
          "header": "1 test covers line 441",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel442": {
          "header": "1 test covers line 442",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel443": {
          "header": "1 test covers line 443",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel444": {
          "header": "1 test covers line 444",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel445": {
          "header": "1 test covers line 445",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel472": {
          "header": "1 test covers line 472",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel473": {
          "header": "1 test covers line 473",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel476": {
          "header": "1 test covers line 476",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel477": {
          "header": "1 test covers line 477",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel478": {
          "header": "1 test covers line 478",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel501": {
          "header": "1 test covers line 501",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testChiSquare</li></ul>",
          "footer": ""
        },
        "panel512": {
          "header": "1 test covers line 512",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel522": {
          "header": "1 test covers line 522",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel523": {
          "header": "1 test covers line 523",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel525": {
          "header": "1 test covers line 525",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel526": {
          "header": "1 test covers line 526",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel527": {
          "header": "1 test covers line 527",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel529": {
          "header": "1 test covers line 529",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel530": {
          "header": "1 test covers line 530",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel531": {
          "header": "1 test covers line 531",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
        "panel532": {
          "header": "1 test covers line 532",
          "body": "<ul><li class=\"testPassed\">RandomizerTest::testEntropy</li></ul>",
          "footer": ""
        },
      "dummy": ""
      };

      YAHOO.phpunit.container.prepare = function (e) {
        var elemId = $E.getTarget(e).id;
        var line = elemId.substr(4);
        var panelId = "panel" + line;
        var containerId = "container" + line;

        var panelData = YAHOO.phpunit.container.panelsData[panelId];

        var panel = new YAHOO.widget.Panel(panelId, { visible:false, draggable:false, close:true } );
        panel.setHeader(panelData["header"]);
        panel.setBody(panelData["body"]);
        panel.setFooter(panelData["footer"]);
        panel.render(containerId);

        $E.addListener(elemId, "click", panel.show, panel, true);
        $E.removeListener(elemId, "mouseover");
      };

      function init() {
        var ypc = YAHOO.phpunit.container;
        for (var panelId in ypc.panelsData) {
          var elemId = "line" + panelId.substr(5);
          $E.addListener(elemId, "mouseover", ypc.prepare);
        }
      }

      $E.addListener(window, "load", init);
      //]]>
    </script>
  </body>
</html>
